<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored ="false" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/9/20/020
  Time: 10:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>bookStroes</title>
    <script type="text/javascript" src="/script/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $("a[page]").click(function () {
                var page = $(this).attr("page");
                $("input[name=pageNo]").val(page);
                $("#search").submit();
            })
        })
    </script>
</head>
<body>
<center>
    <h1>观沧海书城</h1><br><br><br>

    <form action="/book/getBooks" method="post" id="search">
        <input type="hidden" name="pageNo" value="${param.pageNo}">
        price: <input type="number" name="minPrice" value="${param.minPrice}">---
        <input type="number" name="maxPrice" value="${param.maxPrice}">
        <input type="submit" value="查询">
        <table cellpadding="12">
            <tr>
                <th>书名和作者</th>
                <th>价格</th>
                <th>&nbsp;&nbsp;</th>
            </tr>
            <c:forEach var="bookpage" items="${books.list}">

                <tr>
                    <th><a href="">${bookpage.title}</a><br>${bookpage.author} </th>
                    <th>${bookpage.price}</th>
                    <th><a href="">加入购物车</a> </th>
                </tr>
            </c:forEach>
        </table><br>
        共有 &nbsp;${books.totalpageNumber} &nbsp;页  &nbsp; 当前是第 &nbsp;${books.pageNo} &nbsp;页 &nbsp;

        <c:if test="${books.hasPrev }">
            <a href="javascript:;" page="1">首页</a> &nbsp;
            <a href="javascript:;" page="${bookpage.prevPage}">上一页</a> &nbsp;
        </c:if>
        <c:if test="${books.hasNext}">
            <a href="javascript:;" page="${books.nextPage}">下一页</a> &nbsp;
            <a href="javascript:;" page="${books.totalpageNumber}">末页</a> &nbsp;
        </c:if>
        <%--跳转到 &nbsp;<input type="text" id="pageNo" name="pageNo">&nbsp;页--%>
    </form>

</center>
</body>
</html>
